package com.jt.controller;

import com.jt.pojo.Report;
import com.jt.serivce.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class ReportController {
    @Autowired
    private ReportService reportService;
    @PostMapping("/addreport")
    public String addReport(Report report){
        reportService.addReport(report);
        System.out.println("新增成功");
        return "新增成功";
    }
    @GetMapping("/getreport")
    public List<Report> getReport(){
        List<Report> reportsList = reportService.getReport();
        return reportsList;
    }

}
